<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- 学期计划关联到班 -->
<div id="dialog-message">
<div class="" style="padding: 5px;"> 
	<div style="float:right;">
		  <input type="text" id="serch_text_teacher" style="width:250px" placeholder="输入名称">
	</div>
</div>
  <table class="table table-striped table-hover table-bordered">
	  <thead> 
			<tr id="sys_learnPlant_table_title">
				  <th  width="40">编号</th>
				  <th  width="20" fname="nameCheckBox"><input id="nameCheckBox" type="checkbox"></th>
				  <th  width="100" fname="name">环节名称</th>
				  <th  width="100" fname="name">环节名称</th>
				  <th  width="300" fname="pName">环节目录</th> 
				  <th  width="100" fname="adress">地点</th>
				  <th  width="100" fname="keshi">课时</th>  
			 </tr>
	 	 </thead>
		  <tbody id="sys_learnPlant_table">
			 
		  </tbody>
	</table> 
	<ul class="pagination" id="learnPlant_pagination">
		  
	</ul>  	
</div>
<script>
(function(){
	//改变他的启用禁用的状态
	function changelearnPlantState(){
	 	$("#sys_learnPlant_table").children().click(function(){
	 		var allc =$("[name=sys_learnPlant_table_checkbox]");
			for(var i=0;i<allc.length;i++){
				$(allc[i])[0].checked=$(this)[0].checked;
			} 
			if($(this).find("[name=sys_learnPlant_table_checkbox]")[0].checked==true){
				$(this).find("[name=sys_learnPlant_table_checkbox]")[0].checked=false;
			}else{
				$(this).find("[name=sys_learnPlant_table_checkbox]")[0].checked=true;
			}
		});
	};
	 
	 
	//用户搜索
	function loadlearnPlant(event,data){
		if(typeof(data)=="undefined"){
			data={};
		}
		var url ="${pageContext.request.contextPath}/edu/sys_ClassPlantAction.do?method=getTeacherClassPlant"; 		 
		var cp =$("#learnPlant_pagination").find(".active");
		data.name=$("#serch_text_teacher").val();
		data.start=1;
		if(cp.length>0){
			var ccp=$(cp[0]).text();
			if(parseInt(ccp)){
				data.start=ccp;
			}
		}  
		$("#table_learnPlant").wgrid({
					table_title:"sys_learnPlant_table_title",
					tbodyId:"sys_learnPlant_table",
					pagination:"learnPlant_pagination",
					url:url,
					checkbox:true,
					data:data,
					success:function(){
						//alert(1);
						  changelearnPlantState();
						//changelearnPlantImage();
					}
		});
	};
	//搜索的回车事件
	$('#serch_text_teacher').keydown(function(e){
		if(e.keyCode==13){
			loadlearnPlant(null,{});
		}
	});
	$(function(){
		loadlearnPlant(null,{});
	})
})();
</script>